#pragma once;
#include <iostream>
class nodeType{
private:
	char symbol;
	unsigned int freq;
	nodeType *left;
	nodeType *right;

public:
	nodeType() : 
		symbol(NULL), freq(0), left(NULL), right(NULL)
	{

	}

	~nodeType()
	{
		if(left)
			delete left;
		if(right)
			delete right;
	}
	void setLeft(nodeType *node){this->left = node;}
	void setRight(nodeType *node){this->right = node;}

	nodeType* getLeft(){return left;}
	nodeType* getRight(){return right;}

	void setSymbol(char symbol){this->symbol = symbol;}
	void setFreq(int freq){this->freq = freq;}

	char getSymbol(){return symbol;}
	int getFreq(){return freq;}

	bool nodeType::operator >(nodeType &other)
	{
		return freq > other.freq;
	}
};

struct CompnodeTypePtrs2
{
	bool operator()(nodeType* lhs, nodeType* rhs) const {
		return lhs->getFreq() < rhs->getFreq() ;
	}
};

struct CompnodeTypePtrs
{
	bool operator()(nodeType* lhs, nodeType* rhs) const {
		return lhs->getFreq() > rhs->getFreq() ;
	}
};